package com.club.football.controller;

import com.club.football.dto.PageDto;
import com.club.football.req.IntegralPageReq;
import com.club.football.service.IntegralService;
import com.club.football.utils.R;
import com.club.football.vo.IntegralVo;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

import static com.club.football.common.CommonConstants.GET_INFO_OK;

/**
 * 积分控制器
 *
 * @author 1
 * @date 2024/02/15
 */
@RestController
@RequestMapping("/Integral")
@AllArgsConstructor
public class IntegralController {

    @Resource
    private IntegralService integralService;


    /**
     * 页面
     *
     * @param integralPageReq 完整页面请求
     * @return {@link R}<{@link PageDto}<{@link IntegralVo}>>
     */
    @GetMapping("/list")
    public R<List<IntegralVo>> list(@Valid IntegralPageReq integralPageReq) {
        return R.ok(integralService.list(integralPageReq.getEventsId()), GET_INFO_OK);
    }


}
